from typing import List


def quick_sort(arr: List[int], left: int, right: int) -> int:
    if left == right:
        return arr[left]
    i = left - 1
    j = right + 1
    x = arr[(i + j) // 2]
    while i < j:
        while True:
            i += 1
            if arr[i] >= x:
                break
        while True:
            j -= 1
            if arr[j] <= x:
                break
        if i < j:
            arr[i], arr[j] = arr[j], arr[i]
    n = j - left + 1
    global k
    if k <= n:
        return quick_sort(arr, left, j)
    else:
        k -= n
        return quick_sort(arr, j+1, right)


n, k = map(int, input().smit())
a = list(map(int, input().smit()))
print(quick_sort(a, 0, n-1))

